package com.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONArray;
import com.dao.usersDao;
import com.pojo.vo.vo_ResponseBody;
import com.pojo.vo.vo_User_Manager;
import com.service.ManagerService;
@Service("managerService")
public class ManagerServiceImpl implements ManagerService{

	@Autowired
	private usersDao usersDao;
	
	@Override
	public String getAllUser() {
		List<vo_User_Manager> list=new ArrayList<>();
		list=usersDao.getAllUserByEnable(false);
		if(list.size()<=0){
			return JSONArray.toJSONString(new vo_ResponseBody(0, -1, "暂无"));
		}
		return JSONArray.toJSONString(new vo_ResponseBody(0, 0, JSONArray.toJSONString(list)));
	}

	@Override
	public String changeStateByUsers_id(Integer users_id, Boolean enable) {
		int i=usersDao.changeStateByUsers_id(users_id,enable);
		if(i<=0){
			return JSONArray.toJSONString(new vo_ResponseBody(0, 0, "设置状态失败，请刷新列表重新操作"));
		}
		return JSONArray.toJSONString(new vo_ResponseBody(0, 0, "设置成功"));
	}

}
